package com.ssyt.yt1.day8;

class Fruit {

	public void printName() {
		System.out.println("Fruit...");
	}
}

class Apple extends Fruit {

	@Override
	public void printName() {
		System.out.println("Apple...");
	}
}

class Orange extends Fruit {

	@Override
	public void printName() {
		System.out.println("Orange...");
	}
}

class Banana extends Fruit {

	@Override
	public void printName() {
		System.out.println("Banana...");
	}
}

class Watermelo extends Fruit {

	@Override
	public void printName() {
		System.out.println("Watermelo...");
	}
}

public class PolymorphismDemo2 {

	public static void main(String[] args) {
		// invokeApple(new Apple());
		// invokeOrange(new Orange());
		// invokeBanana(new Banana());

		invoke(new Apple());
		invoke(new Orange());
		invoke(new Banana());
		invoke(new Watermelo());
	}

	// public static void invokeApple(Apple apple) {
	// // 30 lines
	// apple.printName();
	// // 30 lines
	// }
	//
	// public static void invokeOrange(Orange orange) {
	// // 30 lines
	// orange.printName();
	// // 30 lines
	// }
	//
	// public static void invokeBanana(Banana banana) {
	// // 30 lines
	// banana.printName();
	// // 30 lines
	// }

	public static void invoke(Fruit fruit) {
		// 30 lines
		fruit.printName();
		// 30 lines
	}
}
